﻿namespace TestTool.GUI
{
    using System;
    using System.Globalization;
    using System.Linq;
    using System.Threading;
    using System.Windows.Forms;

    internal static class Program
    {
        [STAThread]
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if ((args.Length == 0) || args.Contains<string>("-v"))
            {
                Application.Run(new MainForm());
            }
            else
            {
                CompactProcessingForm emptyForm = new CompactProcessingForm {
                    ShowInTaskbar = false
                };
                Thread thread = new Thread(new ThreadStart(new Action(delegate {
                    new SilentProcessingController(emptyForm).Run(args);
                    if (emptyForm.Created)
                    {
                        emptyForm.Invoke(new Action(emptyForm.Close));
                    }
                }).Invoke));
                emptyForm.Shown += (s, e) => thread.Start();
                Application.Run(emptyForm);
            }
        }
    }
}

